import request from '@/utils/request'

// 查询订单结算列表
export function listSettlement(query) {
  return request({
    url: '/prod-api/supplier/settlement/list',
    method: 'get',
    params: query
  })
}

// 查询待结算订单
export function applySettlementList(query) {
  return request({
    url: '/prod-api/supplier/settlement/applySettlement/list',
    method: 'get',
    params: query
  })
}

// 查询结算订单详细订单
export function getSettlementDetailById(settlementId){
  return request({
    url: '/prod-api/supplier/settlement/applySettlement/getSettlementDetailById/' + settlementId,
    method: 'get'
  })
}


// 订单申请结算
export function applySettlement(settlementIds) {
  return request({
    url: '/prod-api/supplier/settlement/applySettlement/' + settlementIds,
    method: 'put'
  })
}


// 查询订单结算详细
export function getSettlement(settlementId) {
  return request({
    url: '/prod-api/supplier/settlement/' + settlementId,
    method: 'get'
  })
}

// 新增订单结算
export function addSettlement(data) {
  return request({
    url: '/prod-api/supplier/settlement',
    method: 'post',
    data: data
  })
}

// 修改订单结算
export function updateSettlement(data) {
  return request({
    url: '/prod-api/supplier/settlement',
    method: 'put',
    data: data
  })
}

// 删除订单结算
export function delSettlement(settlementId) {
  return request({
    url: '/prod-api/supplier/settlement/' + settlementId,
    method: 'delete'
  })
}

// 订单提交审核
export function updateAuditStatus(settlementId) {
  const data = {
    settlementId
  }
  return request({
    url: '/prod-api/supplier/settlement/updateAuditStatus',
    method: 'put',
    data: data
  })
}

// 订单撤销审核
export function updateAuditRevocation(settlementId) {
  const data = {
    settlementId
  }
  return request({
    url: '/prod-api/supplier/settlement/updateAuditRevocation',
    method: 'put',
    data: data
  })
}

// 订单撤销审核
export function updateAudit(settlementId,auditMsg,auditStatus) {
  const data = {
    settlementId,
    auditMsg,
    auditStatus
  }
  return request({
    url: '/prod-api/supplier/settlement/updateAudit',
    method: 'put',
    data: data
  })
}


// 订单确认收款
export function updateReceiveStatus(settlementId) {
  const data = {
    settlementId
  }
  return request({
    url: '/prod-api/supplier/settlement/updateReceiveStatus',
    method: 'put',
    data: data
  })

}

// 订单打款收款
export function updatePayStatus(settlementId) {
  const data = {
    settlementId
  }
  return request({
    url: '/prod-api/supplier/settlement/updatePayStatus',
    method: 'put',
    data: data
  })
}
